import fetch from "node-fetch";

const url = "http://ajax-base-api-t.itheima.net/api/getbooks?id=1";
const getData = async () => {
  try {
    const res = await fetch(url);
    console.log(res.ok); //返回布尔类型，判断请求是否ok
    console.log(res.status); //返回状态码
    console.log(res.statusText); //返回状态文本信息
    console.log(res.url); //返回url

    // const json = await res.json();
    // console.log(json);
  } catch (error) {
    console.log(error);
  }
};

getData();
